package com.monlyu.bean;

import org.apache.commons.lang.StringUtils;

import com.monlyu.util.StringUtil;

/********************************************************************************
 * 
 * <b>功能描述☞</b>存储分页标记的标签,包含页号,页大小,关键字,排序类型,排序字段<br>
 * 
 * <b>开发公司☞</b>重庆唯尼科技有限公司<br>
 * <b>版权☞</b>本文件归重庆唯尼科技有限公司所有<br>
 * <b>项目名☞</b>monlyu<br>
 * <b>文件路径☞</b>com.monlyu.bean.Page.java<br>
 * <b>开发日期☞</b>2010-1-12 <br>
 * 
 * @author monlyu
 * @since JDK 5
 * @version 1.0.5
 * 
 ********************************************************************************/
public class Page {
	/** 这个为升序 */
	public static final boolean ASC = true;
	/** 这个为降序 */
	public static final boolean DESC = false;

	private int no;
	private int size;
	private String key;
	private boolean asc;
	private String store;

	public Page(int _no, int _size, String _key, boolean _asc, String _store) {
		this.no = _no;
		this.size = _size;
		this.key = StringUtil.trim(_key);
		this.asc = _asc;
		if (!StringUtil.isTrimEmpty(_store)) {
			if (_store.length() > 0 && _store.charAt(0) == '-') {
				this.asc = Page.DESC;
			}
			this.store = _store;
		} else {
			this.store = null;
		}
	}

	public int getNo() {
		return no;
	}

	public void setNo(int no) {
		this.no = no;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = StringUtils.trimToNull(key);
	}

	public boolean isAsc() {
		return asc;
	}

	public void setAsc(boolean asc) {
		this.asc = asc;
	}

	public String getStore() {
		return store;
	}

	public void setStore(String store) {
		this.store = StringUtil.isTrimEmpty(store) ? null : store;
	}
}